#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QDebug>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)

{
    ui->setupUi(this);

    m_me = new Me;
    m_girl = new GirlFriend;

    connect(m_girl, &GirlFriend::Hungry,m_me,&Me::Eat);
    connect(ui->go_to_eat,&QPushButton::clicked, this ,MainWindow::go_to_eat_slot);

    connect(ui->go_to_eat,&QPushButton::clicked, this,MainWindow::EatSloat);




    connect(ui->close_btn,&QPushButton::clicked, this ,MainWindow::close);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::go_to_eat_slot()
{
    //发射自定义信号
    emit m_girl->Hungry();  //emit增强可读性
}

void MainWindow::EatSloat()
{
    emit qDebug()<< "不去干饭？？？？？？？？？？？？？？？？？";
}

